package com.qfedu.micrograss.grass.controller;

import com.qfedu.common.core.common.PageVO;
import com.qfedu.common.core.common.R;
import com.qfedu.micrograss.grass.param.GrassParam;
import com.qfedu.micrograss.grass.param.GrassSearchParam;
import com.qfedu.micrograss.grass.service.GrassService;
import com.qfedu.micrograss.grass.vo.GrassVO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/article")
public class GrassController {
    @Resource
    private GrassService grassService;

    @PostMapping("/add")
    public R addGrass(@RequestBody GrassParam grassParam) {
        grassService.addGrass(grassParam);
        return R.ok();
    }

    @GetMapping("/page")
    public R grassPage(GrassSearchParam grassSearchParam) {
        PageVO<GrassVO> page = grassService.grassPage(grassSearchParam);
        return R.ok(page);
    }
    @PostMapping("/add2")
    public R addGrass2(@RequestBody GrassParam grassParam) {
        grassService.addGrassTask(grassParam);
        return R.ok();
    }

}
